/*
 * @Author: C.
 * @Date: 2023-02-02 13:37:51
 */
/*
 * @Author: C.
 * @Date: 2023-01-29 14:20:11
 */
import { DescItem } from '/@/components/Description/index';
import { fieldsToMaps } from './index';
import { MoreProps } from '../../utils/help/createFields';
import { useI18n } from '/@/hooks/web/useI18n';
import { dataHandle } from '/~/utils/data';
const { t } = useI18n();
export type descFieldType =
  | 'CustomerId'
  | 'Tax'
  | 'Currency'
  | 'BillId'
  | 'BillGui'
  | 'CustomerName'
  | 'DeliveryDate'
  | 'State'
  | 'Creator'
  | 'CreationDate'
  | 'Remarks'
  | 'Id'
  | 'ItemId'
  | 'ItemName'
  | 'Description'
  | 'Unit'
  | 'Quantity'
  | 'Price'
  | 'Amount'
  | 'Stockroom'
  | 'AssociatedNo'
  | 'LotNumber'
  | 'SupplierId'
  | 'Submitter'
  | 'Department'
  | 'SupplierName'
  | 'TDA'
  | 'SalesReps'
  | 'ItemType'
  | 'PhotoUrl'
  | 'BomId'
  | 'DatePeriod'
  // 单据类型
  | 'BillType'
  | 'RelationId'
  // 库位
  | 'StockroomLocation';
export const descFields: (DescItem & MoreProps)[] = [
  {
    field: 'CustomerId',
    label: t('commonField.CustomerId'),
  },
  { field: 'Tax', label: t('commonField.Tax') },
  {
    field: 'Currency',
    label: t('commonField.Currency'),
  },
  {
    field: 'BillId',
    label: t('commonField.BillId'),
  },
  {
    field: 'BillGui',
    label: t('commonField.BillGui'),
  },
  {
    field: 'CustomerName',
    label: t('commonField.CustomerName'),
  },
  {
    field: 'DeliveryDate',
    label: t('commonField.DeliveryDate'),
    filter: 'date',
  },
  {
    field: 'State',
    label: t('commonField.State'),
    filter: 'state',
  },
  {
    field: 'Creator',
    label: t('commonField.Creator'),
  },
  {
    field: 'CreationDate',
    // label: t('commonField.CreationDate'),
    label: t('commonField.CreationTime'),
    filter: 'time',
  },
  {
    field: 'Remarks',
    label: t('commonField.Remarks'),
    span: 3,
  },
  { field: 'Id', label: t('commonField.Id') },
  {
    field: 'ItemId',
    label: t('commonField.ItemId'),
  },
  {
    field: 'ItemName',
    label: t('commonField.ItemName'),
  },
  {
    field: 'Description',
    label: t('commonField.Description'),
  },
  { field: 'Unit', label: t('commonField.Unit'), filter: 'tag' },
  {
    field: 'Quantity',
    label: t('commonField.Quantity'),
  },
  {
    field: 'Price',
    label: t('commonField.Price'),
    filter: 'amount',
  },
  {
    field: 'Amount',
    label: t('commonField.Amount'),
    filter: 'amount',
  },
  {
    field: 'Stockroom',
    label: t('commonField.Stockroom'),
  },
  {
    field: 'AssociatedNo',
    label: t('commonField.AssociatedNo'),
  },
  {
    field: 'RelationId',
    label: '相关单号',
  },
  {
    field: 'LotNumber',
    label: t('commonField.LotNumber'),
  },
  {
    field: 'SupplierId',
    label: t('commonField.SupplierId'),
  },
  {
    field: 'Submitter',
    label: t('commonField.Submitter'),
  },
  {
    field: 'Department',
    label: t('commonField.Department'),
  },
  {
    field: 'SupplierName',
    label: t('commonField.SupplierName'),
  },
  { field: 'TDA', label: t('commonField.TDA'), filter: 'amount' },
  {
    field: 'SalesReps',
    label: '销售员',
  },
  {
    field: 'ItemType',
    label: '标签',
    filter: 'tag',
  },
  {
    field: 'PhotoUrl',
    label: '图片',
    filter: 'image',
  },
  {
    field: 'BomId',
    label: '物料清单',
    filter: 'link',
    componentProps: {
      routerName: 'Ba_Bom_Detail',
      // 效果如{Id:record.cId}
      routeKeyValue: [['Id', 'BomId']],
      // routerMethod 默认 query
    },
  },
  {
    field: 'DatePeriod',
    label: t('commonField.DatePeriod'),
    render(_, data) {
      return `${dataHandle(data.StartDate, 'date')}~${dataHandle(data.EndDate, 'date')}`;
    },
  },
  { field: 'BillType', label: t('commonField.BillType') },
  { field: 'StockroomLocation', label: t('commonField.StockroomLocation') },
];

export default fieldsToMaps<DescItem>(descFields, 'field');

// type Keys = typeof tableFields1[number]['dataIndex'] ;
